package com.tanhua.server.service;

import com.tanhua.dubbo.api.UserLocationApi;
import com.tanhua.server.exception.BusinessException;
import com.tanhua.server.exception.ErrorResult;
import com.tanhua.server.interceptor.UserHolder;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

/**
 * @author lk
 * @date 2022-04-01
 */
@Service
public class BaiduService {

    @DubboReference
    private UserLocationApi userLocationApi;
    //更新地理位置信息
    public void updateLocation(Double longitude, Double latitude, String addrStr) {
        //上报地理位置
       Boolean flag =  userLocationApi.updateLocation(UserHolder.getUserId(),longitude,latitude,addrStr);
       if (flag){
           throw new BusinessException(ErrorResult.error());
       }
    }
}
